package com.example.controller;

import com.example.common.Page;
import com.example.common.PageQueryParam;
import com.example.dto.CommentDto;
import com.example.entity.TCommentEntity;
import com.example.service.TCommentService;
import com.example.vo.CommentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/tcomment")
public class TCommentController {
    @Autowired
    private TCommentService tCommentService;

    @RequestMapping("/query")
    public Page<CommentVo> query(@RequestBody PageQueryParam<TCommentEntity> pageQueryParam){
        Page<CommentVo> page = tCommentService.query(pageQueryParam);
        return page;
    }

    @RequestMapping("/create")
    public Integer create(@RequestBody CommentDto commentDto){
        Integer status = tCommentService.create(commentDto);
        return status;
    }

    @RequestMapping("/delete")
    public Integer delete(@RequestBody CommentDto commentDto){
        Integer status = tCommentService.delete(commentDto);
        return status;
    }

}
